<?
//引入所有子系统信息
include_once("../../../common/script/extender_import.php");


//**获取当前板块资料，必然载入，后续很多读取板块数据库的表格，都写成动态的了。
$_plate=$plate['product'];


//根据页面数量信息，筛选信息，创造url，供页码,跳转等使用
include_once("script/set_url.php");


    //var_dump($_FILES['icon']);

    //这里是设计上传文件的部分：包含图片和附件。视频也应该用这种形式上传
    //统一设置一下保存图片的路径
    $_uf['path']        = ROOT_PATH_ . "/uploadfiles/".$theme_folder."/";

    //创建删除文件存放文件夹
    if(!file_exists($_uf['path'] ."/delete/")){
        mkdir($_uf['path'] ."/delete/",0777,true);
        chmod($_uf['path'] ."/delete/",0777);
    }




    //上传icon
    if (is_uploaded_file($_FILES['icon']['tmp_name']))
    {
        $_uf['upfile']       = $_FILES['icon'];
        $_info               = upload_file($_uf);
        $_REQUEST['ai_icon'] = $_info['name'];
        if(($_REQUEST['ai_icon'])&&($old_detail['icon']!="alpha.gif"))
        {
            rename($_uf['path'].$old_detail['icon'], $_uf['path'] ."delete/".$old_detail['icon']);
        }
    }

    //上传Banner
    if (is_uploaded_file($_FILES['banner']['tmp_name']))
    {
        $_uf['upfile']       = $_FILES['banner'];
        $_info               = upload_file($_uf);
        $_REQUEST['ai_banner'] = $_info['name'];
        if(($_REQUEST['ai_banner'])&&($old_detail['banner']!="alpha.gif")){
            rename($_uf['path'].$old_detail['banner'], $_uf['path'] ."delete/".$old_detail['banner']);
        }
    }

    //上传image1
    if (is_uploaded_file($_FILES['image1']['tmp_name']))
    {
        $_uf['upfile']         = $_FILES['image1'];
        $_info                 = upload_file($_uf);
        $_REQUEST['ai_image1'] = $_info['name'];
        if(($_REQUEST['ai_image1'])&&($old_detail['image1']!="alpha.gif")){
            rename($_uf['path'].$old_detail['image1'], $_uf['path'] ."delete/".$old_detail['image1']);
        }
    }

    //上传image2
    if (is_uploaded_file($_FILES['image2']['tmp_name']))
    {
        $_uf['upfile']         = $_FILES['image2'];
        $_info                 = upload_file($_uf);
        $_REQUEST['ai_image2'] = $_info['name'];
        if(($_REQUEST['ai_image2'])&&($old_detail['image2']!="alpha.gif")){
            rename($_uf['path'].$old_detail['image2'], $_uf['path'] ."delete/".$old_detail['image2']);
        }
    }

    //上传image3
    if (is_uploaded_file($_FILES['image3']['tmp_name']))
    {
        $_uf['upfile']         = $_FILES['image3'];
        $_info                 = upload_file($_uf);
        $_REQUEST['ai_image3'] = $_info['name'];
        if(($_REQUEST['ai_image3'])&&($old_detail['image3']!="alpha.gif")){
            rename($_uf['path'].$old_detail['image3'], $_uf['path'] ."delete/".$old_detail['image3']);
        }
    }


    //上传image4
    if (is_uploaded_file($_FILES['image4']['tmp_name']))
    {
        $_uf['upfile']         = $_FILES['image4'];
        $_info                 = upload_file($_uf);
        $_REQUEST['ai_image4'] = $_info['name'];
        if(($_REQUEST['ai_image4'])&&($old_detail['image4']!="alpha.gif")){
            rename($_uf['path'].$old_detail['image4'], $_uf['path'] ."delete/".$old_detail['image4']);
        }
    }



    //上传image5
    if (is_uploaded_file($_FILES['image5']['tmp_name']))
    {
        $_uf['upfile']         = $_FILES['image5'];
        $_info                 = upload_file($_uf);
        $_REQUEST['ai_image5'] = $_info['name'];
        if(($_REQUEST['ai_image5'])&&($old_detail['image5']!="alpha.gif")){
            rename($_uf['path'].$old_detail['image5'], $_uf['path'] ."delete/".$old_detail['image5']);
        }
    }





    //上传image6
    if (is_uploaded_file($_FILES['image6']['tmp_name']))
    {
        $_uf['upfile']         = $_FILES['image6'];
        $_info                 = upload_file($_uf);
        $_REQUEST['ai_image6'] = $_info['name'];
    }


    //上传image7
    if (is_uploaded_file($_FILES['image7']['tmp_name']))
    {
        $_uf['upfile']         = $_FILES['image7'];
        $_info                 = upload_file($_uf);
        $_REQUEST['ai_image7'] = $_info['name'];
    }


    //上传image8
    if (is_uploaded_file($_FILES['image8']['tmp_name']))
    {
        $_uf['upfile']         = $_FILES['image8'];
        $_info                 = upload_file($_uf);
        $_REQUEST['ai_image8'] = $_info['name'];
    }


    //上传image9
    if (is_uploaded_file($_FILES['image9']['tmp_name']))
    {
        $_uf['upfile'] = $_FILES['image9'];
        $_info                 = upload_file($_uf);
        $_REQUEST['ai_image9'] = $_info['name'];
    }


    //上传image10
    if (is_uploaded_file($_FILES['image10']['tmp_name'])) {
        $_uf['upfile']          = $_FILES['image10'];
        $_info                  = upload_file($_uf);
        $_REQUEST['ai_image10'] = $_info['name'];
    }



    //上传备用图片
    if (is_uploaded_file($_FILES['extend_img']['tmp_name'])) {
        $_uf['upfile']             = $_FILES['extend_img'];
        $_info                     = upload_file($_uf);
        $_REQUEST['ai_extend_img'] = $_info['name'];
        if(($_REQUEST['ai_extend_img'])&&($old_detail['extend_img']!="alpha.gif")){
            rename($_uf['path'].$old_detail['extend_img'], $_uf['path'] ."delete/".$old_detail['extend_img']);
        }
    }


    //上传附件
    if (is_uploaded_file($_FILES['attachment']['tmp_name'])) {
        $_uf["allowExt"] = array('jpeg',
            'jpg',
            'png',
            'gif',
            'rar',
            'zip',
            '7zip',
            'exe',
            'msi',
            'txt',
            'doc',
            'xlsx',
            'pptx',
            'pdf',
            'webp');
        $_uf['upfile']             = $_FILES['attachment'];
        $_info                     = upload_file($_uf);
        $_REQUEST['ai_attachment'] = $_info['name'];
        if($_REQUEST['ai_attachment']){
            rename($_uf['path'].$old_detail['attachment'], $_uf['path'] ."delete/".$old_detail['attachment']);
        }
    }




//处理数据并且update
//获取数据

echo $sql=update_date($table_prefix.$_plate['table']['data'],$_REQUEST,"nid",$_REQUEST['nid']);
    $query = do_query($sql) or die (mysqli_error().$sql);


?>

